package jblip.apps.clip.cmds;

import jblip.BlipClient;
import jblip.apps.clip.ClipPrinter;
import jblip.resources.Update;

public class Get extends ClipCommand {

  @Override
  public void execute(BlipClient client, String[] args) {
    Update m = client.getMessage(Integer.parseInt(args[0]));
    if (client.getLastError() != null) {
      System.out.println("ERROR: " + client.getLastError().toString());
    } else {
      ClipPrinter.print(m);
    }
  }

  @Override
  public String getName() {
    return "get";
  }

  @Override
  public String getUsageMessage() {
    return "<message id>";
  }

}
